* keyboard.c (command_loop_1): Rebuild menu bar if
authorJim Blandy <jimb@redhat.com>
Sat, 10 Apr 1993 08:02:22 +0000 (08:02 +0000)
committerJim Blandy <jimb@redhat.com>
Sat, 10 Apr 1993 08:02:22 +0000 (08:02 +0000)
update_mode_lines is set.

        Since Qmenu_enable is used by non-X-specific code, it shouldn't be
defined in an X-only source file.
* xmenu.c (Qmenu_enable): Definition moved...
(syms_of_xmenu): ... along with initialization ...
* keyboard.c (Qmenu_enable): ... to here ...
(syms_of_keyboard): ... and here.

* keyboard.c (kbd_buffer_get_event): If we get a selection clear
or selection request event, but we were compiled without the
window-system-specific code to handle it, abort.  Don't try to
call a function which doesn't exist.

* keyboard.c (make_lispy_event): In the code which processes mouse
clicks, declare f to be a FRAME_PTR, not a struct frame *; this
works when MULTI_FRAME is not #defined.

src/keyboard.c

index aa8a5e054677f824f8d7af6492dce22632047155..d72125cc98ef64b0880790cded9c872111b25b22 100644 (file)
@@ -354,7 +354,6 @@ int mouse_moved;
 /* Symbols to head events.  */
 Lisp_Object Qmouse_movement;
 Lisp_Object Qscroll_bar_movement;
-
 Lisp_Object Qswitch_frame;
 
 /* Symbols to denote kinds of events.  */
@@ -366,6 +365,8 @@ Lisp_Object Qmouse_click;
 Lisp_Object Qevent_kind;
 Lisp_Object Qevent_symbol_elements;
 
+Lisp_Object Qmenu_enable;
+
 /* An event header symbol HEAD may have a property named
    Qevent_symbol_element_mask, which is of the form (BASE MODIFIERS);
    BASE is the base, unmodified version of HEAD, and MODIFIERS is the
@@ -945,7 +946,16 @@ command_loop_1 ()
        {
          struct frame *f = XFRAME (XCONS (tem)->car);
          struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f));
+
+         /* If the user has switched buffers or windows, we need to
+            recompute to reflect the new bindings.  But we'll
+            recompute when update_mode_lines is set too; that means
+            that people can use force-mode-line-update to request
+            that the menu bar be recomputed.  The adverse effect on
+            the rest of the redisplay algorithm is about the same as
+            windows_or_buffers_changed anyway.  */
          if (windows_or_buffers_changed
+             || update_mode_lines
              || (XFASTINT (w->last_modified) < MODIFF
                  && (XFASTINT (w->last_modified)
                      <= XBUFFER (w->buffer)->save_modified)))
@@ -1781,16 +1791,28 @@ kbd_buffer_get_event ()
         and don't actually appear to the command loop.  */
       if (event->kind == selection_request_event)
        {
+#ifdef HAVE_X11
          x_handle_selection_request (event);
          kbd_fetch_ptr = event + 1;
          goto retry;
+#else
+         /* We're getting selection request events, but we don't have
+             a window system.  */
+         abort ();
+#endif
        }
 
       if (event->kind == selection_clear_event)
        {
+#ifdef HAVE_X11
          x_handle_selection_clear (event);
          kbd_fetch_ptr = event + 1;
          goto retry;
+#else
+         /* We're getting selection request events, but we don't have
+             a window system.  */
+         abort ();
+#endif
        }
 
 #ifdef MULTI_FRAME
@@ -2076,7 +2098,7 @@ make_lispy_event (event)
        if (event->kind == mouse_click)
          {
            int part;
-           struct frame *f = XFRAME (event->frame_or_window);
+           FRAME_PTR f = XFRAME (event->frame_or_window);
            Lisp_Object window
              = window_from_coordinates (f, XINT (event->x), XINT (event->y),
                                         &part);
@@ -4545,6 +4567,9 @@ syms_of_keyboard ()
   Qmouse_click = intern ("mouse-click");
   staticpro (&Qmouse_click);
 
+  Qmenu_enable = intern ("menu-enable");
+  staticpro (&Qmenu_enable);
+
   Qmode_line = intern ("mode-line");
   staticpro (&Qmode_line);
   Qvertical_line = intern ("vertical-line");